package com.jh.paymentchannel.repository;

import com.jh.paymentchannel.pojo.MiMaiRegister;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface MiMaiRegisterRepository extends JpaRepository<MiMaiRegister,String>,JpaSpecificationExecutor<MiMaiRegister>{

	
	@Query("select mimaregister from  MiMaiRegister mimaregister where mimaregister.userid=:userid and mimaregister.bankCard=:bankCard")
	public MiMaiRegister	getMiMaiRegisterByUseridAndBankCard(@Param("userid") long userid, @Param("bankCard") String bankCard);
	
	@Query("select mimaregister from  MiMaiRegister mimaregister where mimaregister.userid=:userid")
	public MiMaiRegister	getMiMaiRegisterByUserid(@Param("userid") long userid);
	
	//注销用户记录
	@Modifying
	@Query("delete from MiMaiRegister mimaregister where mimaregister.userid=:userid")
	void delMiMaiRegisterByUserid(@Param("userid") long userid);
}
